<template>
	<view class="page">
		<CustomNav :isBack="false" color="#fff" :topBgColor="topBgColor" title="肃州区数据资源池综合分析"></CustomNav>
		<image :src="cloudStorage+'/detail_bg_zl.png'" class="bg-img fade-in" mode="widthFix"></image>
		<view class="info-block">
			<xbSwiperPreview class="fade-in" />
			<view class="info-content">
				<view class="info-item" v-for="item in list" :key="item.id" @click="goDeatil(item.path,item.id)">
					<view class="title LENGKU">{{item.title}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import xbSwiperPreview from '@/components/xb-swiper-preview/index.vue'
	export default {
		components: {
			xbSwiperPreview
		},
		data() {
			return {
				showPdfDialog: false,
				pageNumber: '',
				topBgColor: 'rgba(0,0,0,0)',
				cloudStorage: 'https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool',
				list: [
					{
						id: 3,
						title: '总体情况',
						path: '/page_pack/overall/overall?title=总体情况'
					},
					{
						id: 4,
						title: '农业相关数据',
						path: '/page_pack/agriculture/agriculture?title=农业相关数据'
					},
					{
						id: 5,
						title: '工业相关数据',
						path: '/page_pack/industry/industry?title=工业相关数据'
					},
					{
						id: 6,
						title: '服务业相关数据',
						path: '/page_pack/service/service?title=服务业相关数据'
					},
					{
						id: 7,
						title: '社会事业相关数据',
						path: '/page_pack/society/society?title=社会事业相关数据'
					},
					{
						id: 1,
						title: '在线预览',
						path: ''
					},
					{
						id: 2,
						title: '综合分析',
						path: '/page_pack/deepseek/deepseek?title=综合分析'
					}
				]
			}
		},
		watch: {

		},
		methods: {
			//onShareAppMessage 分享给朋友
			onShareAppMessage: function(res) {
				if (res.from === 'button') {

				}
				return {
					title: '肃州区数据资源池综合分析',
					path: '/pages/index/index'
				}
			},
			onShareTimeline() { // 分享到朋友圈
				return {
					title: '肃州区数据资源池综合分析',
					path: '/pages/index/index'
				}
			},
			goDeatil(path, id) {
				if (path) {
					uni.navigateTo({
						url: path
					});
				}
				if (id == 1) {
					this.confirmViewPdf()
				}
			},
			confirmViewPdf() {
				uni.navigateTo({
					url: '/pages/pdf-viewer/pdf-viewer?new=true'
				});
			},
			cancelViewPdf() {
				this.showPdfDialog = false;
				this.pageNumber = '';
			}
		},
		onLoad(e) {
			// 页面加载时的动画效果
			setTimeout(() => {
				this.topBgColor = 'rgba(2, 86, 255, 0.6)';
			}, 300);
		},
		onPageScroll(e) {
			// 页面滚动时导航栏透明度变化
			if (e.scrollTop > 100) {
				this.topBgColor = 'rgba(2, 86, 255, 0.9)';
			} else {
				this.topBgColor = 'rgba(2, 86, 255, 0.6)';
			}
		}
	}
</script>

<style lang="scss" scoped>
	.page {
		overflow: hidden;
		min-height: 100vh;
		background-color: #FFFFFF;

		/* 自定义导航栏的淡入淡出动画 */
		::v-deep .nav-bar {
			transition: background-color 0.3s ease;
		}

		.bg-img {
			width: 100%;
		}

		/* 添加淡入动画效果 */
		.fade-in {
			animation: fadeIn 1.2s ease forwards;
		}

		@keyframes fadeIn {
			from {
				opacity: 0;
			}
			to {
				opacity: 1;
			}
		}

		.info-block {
			position: relative;
			padding: 30rpx;

			.info-content {
				.info-item:nth-child(6) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/1.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(7) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/2.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(3) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/3.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(4) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/4.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(5) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/5.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(1) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/6.png')no-repeat center;
					background-size: 100%;
				}

				.info-item:nth-child(2) {
					background: url('https://suzhouqu-static-1306862033.cos.ap-chengdu.myqcloud.com/suzhou_-district-data-resource-pool/7.png')no-repeat center;
					background-size: 100%;
				}

				.info-item {
					margin-top: 30rpx;
					width: 100%;
					height: 150rpx;
					padding: 30rpx;
					border-radius: 30rpx;
					display: flex;
					align-items: center;
					transition: all 0.3s ease;
					position: relative;
					overflow: hidden;
					box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
					
					/* 优化动画效果 */
					&:active {
						transform: translateY(3rpx);
						box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
					}
					
					/* 使用交错的动画效果 */
					animation: fadeInRight 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
					opacity: 0;
					
					@for $i from 1 through 7 {
						&:nth-child(#{$i}) {
							animation-delay: 0.08s * $i;
						}
					}

					.title {
						font-size: 40rpx;
						color: #0256ff;
						font-weight: bold;
						/* 添加文字动画效果 */
						transition: transform 0.3s ease;
					}
				}
			}
		}

		/* 修改动画效果为从右侧淡入 */
		@keyframes fadeInRight {
			from {
				opacity: 0;
				transform: translateX(30px);
			}
			to {
				opacity: 1;
				transform: translateX(0);
			}
		}

		.pdf-dialog {
			position: fixed;
			top: 0;
			left: 0;
			right: 0;
			bottom: 0;
			background: rgba(0, 0, 0, 0.5);
			z-index: 999;
			display: flex;
			align-items: center;
			justify-content: center;
			
			/* 添加弹窗动画 */
			animation: fadeIn 0.3s ease forwards;
			
			@keyframes fadeIn {
				from {
					opacity: 0;
				}
				to {
					opacity: 1;
				}
			}

			.dialog-content {
				background: #fff;
				border-radius: 20rpx;
				padding: 40rpx;
				width: 80%;
				max-width: 600rpx;
				transform: scale(0.9);
				opacity: 0;
				animation: zoomIn 0.3s 0.1s ease forwards;
				
				@keyframes zoomIn {
					from {
						transform: scale(0.9);
						opacity: 0;
					}
					to {
						transform: scale(1);
						opacity: 1;
					}
				}

				.dialog-title {
					font-size: 32rpx;
					text-align: center;
					margin-bottom: 30rpx;
					color: #333;
				}

				.page-input {
					border: 1px solid #ddd;
					border-radius: 8rpx;
					padding: 20rpx;
					margin-bottom: 30rpx;
					width: 100%;
					box-sizing: border-box;
				}

				.dialog-buttons {
					display: flex;
					justify-content: space-between;
					gap: 20rpx;

					button {
						flex: 1;
						padding: 20rpx;
						border-radius: 8rpx;
						font-size: 28rpx;
						border: none;
						transition: all 0.2s ease;
						
						&:active {
							transform: scale(0.95);
						}
					}

					.confirm-btn {
						background: #0256ff;
						color: #fff;
					}

					.cancel-btn {
						background: #f5f5f5;
						color: #666;
					}
				}
			}
		}
	}
	
	/* 添加轮播图动画效果 */
	::v-deep .swiper-img {
		animation: fadeIn 1s ease forwards;
	}
</style>